package com.arvin.mapper;

import com.arvin.pojo.Log;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface LogMapper {

    /**
     * 新增日志
     * @param log
     */
    @Insert("insert into t_log(username, log_operate, log_type, log_time) " +
            "value(#{username},#{logOperate},#{logType},#{logTime})")
    void insert(Log log);

    Page<Log> getLogInfo(String username, String logType,
                         LocalDate logBeginTime, LocalDate logEndTime);

    /**
     * 获取全部日志信息
     * @return
     */
    @Select("select * from t_log")
    List<Log> getAllLog();

    /**
     * 根据id删除日志
     * @param logIds
     */
    void deleteLogByIds(List<Integer> logIds);
}
